﻿<%@ Page Title="Cài đặt tài khoản" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Setting.aspx.cs" Inherits="MailBox.Setting" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <div class="col-md-12 hidden-xs col-sm-12 col-lg-12 lefttab" style="padding: 0px;">
        <ul class="col-md-12 col-sm-12 col-lg-12" role="tablist" style="padding: 0px;">
            <li class="active" style="padding: 0px; width: auto !important; margin-right: 10px; float: left;">
                <a class="btn btn-default" href="#taochuky" role="tab" data-toggle="tab" style="border-radius: 0px;"><span class="fa fa-pencil-square-o" style="margin-right: 10px;"></span>Tạo chữ ký</a></li>
            <li style="padding: 0px; width: auto !important; margin-right: 10px; float: left;">
                <a class="btn btn-default" href="#tudongtraloi" role="tab" data-toggle="tab" style="border-radius: 0px;"><span class="fa fa-random" style="margin-right: 10px;"></span>Tự động trả lời</a></li>
        </ul>
    </div>
    <div class="tab-content col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
        <div class="tab-pane active  col-md-12 col-xs-12 col-sm-12 col-lg-12" id="taochuky" style="padding: 5px 0px;">
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 5px; border: 1px solid #ddd;">
                <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="color: #555; margin: 10px 0px; font-size: 18px;">
                    Tạo chữ ký
                </div>
                <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12" style="padding: 0px;">
                    <div class="col-md-3 col-sm-4 col-lg-3 col-xs-12" style="padding: 5px;">
                        <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="padding: 5px;">
                            <input id="radio-input-1" type="radio" value="0" name="radio-group1" checked>
                            <label for="radio-input-1" class="input-helper input-helper--radio" style="font-size: 14px; font-weight: normal;">Không dùng chữ ký</label>
                        </div>
                        <div class="col-md-12 col-lg-12 col-sm-12" style="padding: 5px;">
                            <input id="radio-input-2" type="radio" value="1" name="radio-group1">
                            <label for="radio-input-2" class="input-helper input-helper--radio" style="font-size: 14px; font-weight: normal;">Sử dụng chữ ký</label>
                        </div>
                    </div>
                    <div class="col-md-9 col-sm-8 col-lg-9 col-xs-12" style="padding: 5px; z-index: 3;">
                        <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12">
                            <div id="editor_signature" style="border: 1px solid #ddd; padding: 10px; height: 250px;">
                            </div>
                            <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 5px; border: 1px solid #ddd; border-top: 0px;">
                                <div id="toolbar_signature" class="sc-toolbar-container toolbar" style="padding: 0px;">
                                    <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px;">
                                        <div class="sc-format-group col-md-12" style="margin-right: 0px; box-sizing: inherit; padding: 0px 0px;">
                                            <div class="col-xs-12" style="padding: 5px;">
                                                <span class="btn btn-default" id="btnSave_S" style="height: 34px; border-radius: 0px; float: left; background: #000; color: #fff; margin: 5px;">Lưu chữ ký</span>
                                                <span class="sc-bold sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-italic sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-strike sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-underline sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-link sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="tab-pane col-md-12 col-xs-12" id="tudongtraloi" style="padding: 5px 0px;">
            <div class="col-md-12 col-xs-12" style="padding: 5px; border: 1px solid #ddd;">
                <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="color: #555; margin: 10px 0px; font-size: 18px;">
                    Tự động trả lời
                </div>
                <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12" style="padding: 0px;">
                    <div class="col-md-3 col-sm-4 col-lg-3 col-xs-12" style="padding: 5px;">
                        <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="padding: 5px;">
                            <input id="radio-input-3" type="radio" value="0" name="radio-group2" checked>
                            <label for="radio-input-3" class="input-helper input-helper--radio" style="font-size: 14px; font-weight: normal;">Không dùng tự động trả lời</label>
                        </div>
                        <div class="col-md-12 col-lg-12 col-sm-12" style="padding: 5px;">
                            <input id="radio-input-4" type="radio" value="1" name="radio-group2">
                            <label for="radio-input-4" class="input-helper input-helper--radio" style="font-size: 14px; font-weight: normal;">Sử dụng tự động trả lời</label>
                        </div>
                    </div>
                    <div class="col-md-9 col-sm-8 col-lg-9 col-xs-12" style="padding: 5px; z-index: 3;">
                        <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12">
                            <div id="editor_autoreply" style="border: 1px solid #ddd; padding: 10px; height: 250px;">
                            </div>
                            <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 5px; border: 1px solid #ddd; border-top: 0px;">
                                <div id="toolbar_autoreply" class="sc-toolbar-container toolbar" style="padding: 0px;">
                                    <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px;">
                                        <div class="sc-format-group col-md-12" style="margin-right: 0px; box-sizing: inherit; padding: 0px 0px;">
                                            <div class="col-xs-12" style="padding: 5px;">
                                                <span class="btn btn-default" id="btnSaveR" style="height: 34px; border-radius: 0px; float: left; background: #000; color: #fff; margin: 5px;">Lưu trả lời tự động</span>
                                                <span class="sc-bold sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-italic sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-strike sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-underline sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                                <span class="sc-link sc-format-button" style="padding: 8px; border: 1px solid #ddd; border-radius: 0px; margin: 5px;"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
        <script>
            jQuery(function () {
                var editor_s = new Quill('#editor_signature', {
                    modules: {
                        'toolbar': { container: '#toolbar_signature' },
                        'link-tooltip': true
                    },
                    theme: 'snow',
                });
                var editor_r = new Quill('#editor_autoreply', {
                    modules: {
                        'toolbar': { container: '#toolbar_autoreply' },
                        'link-tooltip': true
                    },
                    theme: 'snow',
                });
                var url = "Setting.aspx/LoadData";
                $.ajax({
                    type: "POST",
                    url: url,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        editor_s.setHTML(data.d.Signature);

                        var radios = $('input:radio[name=radio-group1]');
                        //alert(data.d.IsUse_S);
                        if (data.d.IsUse_S) {
                            radios.filter('[value=1]').prop('checked', true);
                            //alert(data.d.isuse_s);
                        }
                        else
                            radios.filter('[value=0]').prop('checked', true);
                        //alert(data.d.AutoReply);
                        editor_r.setHTML(data.d.AutoReply);
                        if (data.d.IsUse_R)
                            $("#radio-input-4").prop('checked', true);
                        else $("#radio-input-3").prop('checked', true);
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        // Handle errors here
                        console.log('ERRORS: ' + textStatus);
                        alert("Lưu không thành công!");
                        // STOP LOADING SPINNER
                    }
                });
                $(document).on('click', '#btnSave_S', function (event) {
                    var postValue = "{signature:'" + editor_s.getHTML() + "',isuse:" + $('input[name=radio-group1]:checked').val() + "}";
                    var url = "Setting.aspx/SaveSignature";
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: postValue,
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            alert('Lưu thành công');
                        },
                        error: function (jqXHR, textStatus, errorThrown) {
                            // Handle errors here
                            console.log('ERRORS: ' + textStatus);
                            alert("Lưu không thành công!");
                            // STOP LOADING SPINNER
                        }
                    });
                });
                $(document).on('click', '#btnSaveR', function (event) {
                    var postValue = "{autoreply:'" + editor_r.getHTML() + "',isuse:" + $('input[name=radio-group2]:checked').val() + "}";
                    var url = "Setting.aspx/SaveAutoReply";
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: postValue,
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            alert('Lưu thành công');
                        },
                        error: function (jqXHR, textStatus, errorThrown) {
                            // Handle errors here
                            console.log('ERRORS: ' + textStatus);
                            alert("Lưu không thành công!");
                            // STOP LOADING SPINNER
                        }
                    });
                });
            });
    </script>

</asp:Content>

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="SmartPhoneLeft">
    <div class="col-xs-12" style="width: 100%; padding: 5px 0px; text-align: center;">
        <div class="col-xs-12" style="padding: 5px 0px; text-align: center;">

            <div class="col-xs-3" style="padding: 5px; text-align: right;">
                <img class="img-circle img img-thumbnail dropdown-toggle" data-toggle="dropdown" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/c6.0.160.160/p160x160/10450596_545002008956679_2387905694320684413_n.jpg" style="width: 100%;" />
                <div class="dropdown-menu" style="width: 300px; left: 0px !important; padding: 10px;">
                    <div class="col-xs-12" style="padding: 0px;">
                        <div class="col-xs-4" style="padding: 0px;">
                            <img class="img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/c6.0.160.160/p160x160/10450596_545002008956679_2387905694320684413_n.jpg" style="width: 100%;" />
                        </div>
                        <div class="col-xs-8" style="padding: 4px 20px;">
                            <p style="font-size: 16px;">
                                <b style="font-size: 14px;">Yas Jek</b><br />
                                yas.jek@gmail.com
                            </p>
                            <p style="margin: 0px;">
                                <span class="btn btn-default" style="width: 100%; height: 34px; border-radius: 0px;" onclick="window.open('Profile.aspx','_self');">Thông tin</span>
                            </p>
                        </div>
                    </div>
                    <div class="col-xs-12" style="padding: 0px;">
                        <div class="col-xs-6" style="padding: 7px 5px 0px 0px; line-height: 34px;">
                            <span class="btn btn-default" style="width: 100%; height: 34px; border-radius: 0px;" onclick="window.open('Setting.aspx','_self');">Cài đặt</span>
                        </div>
                        <div class="col-xs-6" style="padding: 7px 0px 0px 5px; line-height: 34px;">
                            <span class="btn btn-default" style="width: 100%; height: 34px; border-radius: 0px;" onclick="window.open('Logout.aspx','_self');">Đăng xuất</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-7" style="padding: 5px;">
                <div class="col-xs-12" style="padding: 0px; font-weight: bold; text-align: center;">
                    <span class="visible-xs noprint" style="line-height: 26px; color: #555;">bthehien@gmail.com</span>
                </div>
            </div>
            <div class="col-xs-2" style="padding: 0px;">
                <span class="menu-anchor visible-xs pull-right noprint" style="border: 1px solid #ddd; margin: 10px;"></span>
            </div>
        </div>
    </div>
    <hr />
    <div class="col-xs-12 menu_left" style="padding: 0px;">
        <ul>
            <li class="active"><a href="default.aspx">Hộp thư đến (2)</a></li>
            <li><a href="#">Thư đã gửi</a></li>
            <li><a href="#">Hộp thư Spam</a></li>
            <li><a href="#">Thư nháp</a></li>
            <li><a href="#">Thùng rác</a></li>
        </ul>
    </div>
</asp:Content>
